//
//  EPColor.m
//  EPTool
//
//  Created by guoshiqing on 2018/4/13.
//  Copyright © 2018年 云数动能科技. All rights reserved.
//

#import "EPColor.h"

@implementation EPColor

/*
 * 背景色
 */
+ (UIColor *)epColor_Bg
{
    return EPCOLOR_HEX(0xf7f8f9);
}
+ (UIColor *)epColor_Gray
{
    return EPCOLOR_HEX(0xcbcccd);
}
+ (UIColor *)epColor_UnderLine
{
    return EPCOLOR_HEX(0xf4f5f6);
}
+ (UIColor *)epColor_LightGray
{
    return EPCOLOR_HEX(0xf7f8f9);
}


/*
 * 文本色
 */
+ (UIColor *)epColor_Nav
{
    return EPCOLOR_HEX(0x333333);
}
+ (UIColor *)epColor_statusMessageGray
{
    return EPCOLOR_HEX(0x666666);
}
+ (UIColor *)epColor_descMessageGray
{
    return EPCOLOR_HEX(0x999999);
}
+ (UIColor *)epColor_BGGray
{
    return EPCOLOR_HEX(0xcccccc);
}

/*
 * 主题色
 */
+ (UIColor *)epColor_Blue
{
    return EPCOLOR_HEX(0x3296fa);
}
+ (UIColor *)epColor_LineBlue
{
    return EPCOLOR_HEX(0x82befa);
}
+ (UIColor *)epColor_LightBlue
{
//    return EPCOLOR_HEXAndAlpha(0x3c82fa, 0.5);
    return EPCOLOR_HEXAndAlpha(0x82befa, 0.5);
}
+ (UIColor *)epColor_DeepBlue
{
//    return EPCOLOR_HEX(0x3264c8);
    return EPCOLOR_HEX(0x0a64fa);
}

/*
 * 辅助色
 */
+ (UIColor *)epColor_BGGreen
{
    return EPCOLOR_HEX(0x17c295);
}
+ (UIColor *)epColor_BGYellow
{
    return EPCOLOR_HEX(0xfbe861);
}
+ (UIColor *)epColor_BGLightOrange
{
    return EPCOLOR_HEX(0xff943e);
}
+ (UIColor *)epColor_BGOrange
{
    return EPCOLOR_HEX(0xFF943E);
}
+ (UIColor *)epColor_BGLightRed
{
    return EPCOLOR_HEX(0xf2725d);
}
+ (UIColor *)epColor_BGRed
{
    return EPCOLOR_HEX(0xf25642);
}
+ (UIColor *)epColor_BGPink
{
    return EPCOLOR_HEX(0xe86087);
}


/*
 * 提示色
 */
+ (UIColor *)epColor_TitleBlack
{
    return [EPColor epColor_Nav];
}
+ (UIColor *)epColor_GreenText
{
    return EPCOLOR_HEX(0x4dcd964);
}
+ (UIColor *)epColor_YellowText
{
    return EPCOLOR_HEX(0xffcc00);
}
+ (UIColor *)epColor_RedText
{
    return EPCOLOR_HEX(0xff3b30);
}


+ (UIColor *)epColor_White
{
    return [UIColor whiteColor];
}
+ (UIColor *)epColor_BGBlue
{
    return EPCOLOR_HEX(0xeaf4fe);
}
+ (UIColor *)epColor_Violet
{
    return EPCOLOR_HEX(0x6971da);
}


// 十六进制值字符串到rgb
+ (UIColor *)colorWithHexString:(NSString *)hexString
{
    return [self colorWithHexString:hexString alpha:1.0f];
}

+ (UIColor *)colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha
{
    hexString = [[hexString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    
    UIColor *defaultColor = [UIColor clearColor];
    
    if (hexString.length < 6) return defaultColor;
    if ([hexString hasPrefix:@"#"]) hexString = [hexString substringFromIndex:1];
    if ([hexString hasPrefix:@"0X"]) hexString = [hexString substringFromIndex:2];
    if (hexString.length != 6) return defaultColor;
    
    // method1是苹果官方提供的类，功能和method2类似，选一种即可。
    
    //method1
    NSScanner *scanner = [NSScanner scannerWithString:hexString];
    unsigned int hexNumber;
    if (![scanner scanHexInt:&hexNumber]) return defaultColor;
    
    //method2
    //    const char *char_str = [hexString cStringUsingEncoding:NSUTF8StringEncoding];
    //    int hexNum;
    //    sscanf(char_str, "%x", &hexNum);
    
    return EPCOLOR_HEXAndAlpha(hexNumber, alpha);
}


@end
